package com.ruicar.afs.cloud.apply.archive.controller;

import com.ruicar.afs.cloud.apply.archive.service.MortgageService;
import com.ruicar.afs.cloud.archive.dto.MortgageDto;
import com.ruicar.afs.cloud.common.core.util.IResponse;
import io.swagger.annotations.ApiOperation;
import lombok.AllArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

/**
 * 抵押贷controller
 *
 * @author 耿继辉
 */
@RestController
@Slf4j
@AllArgsConstructor
@ApiOperation("抵押贷管理-正常")
@RequestMapping("/mortgage")
public class MortgageController {

    private final MortgageService mortgageService;

    /**
     * 解抵押-解抵押列表查询
     *
     * @param condition
     * @return
     */
    @ApiOperation("解抵押-解抵押列表查询")
    @PostMapping("/getMortgageList")
    public IResponse getMortgageList(@RequestBody MortgageDto condition) {
        return this.mortgageService.getMortgageList(condition);
    }


    /**
     * 解抵押-解抵押列表模糊查询
     *
     * @param condition
     * @return
     */
    @ApiOperation("解抵押-解抵押列表模糊查询")
    @PostMapping("/matching")
    public IResponse matching(@RequestBody MortgageDto mortgageDto) {
        return this.mortgageService.matching(mortgageDto);
    }

    /**
     * 根据合同id获取解抵押信息
     *
     * @param condition
     * @return
     */
    @ApiOperation("根据合同id获取解抵押信息")
    @PostMapping("/get")
    public IResponse get(@RequestBody MortgageDto mortgageDto) {
        return this.mortgageService.get(mortgageDto);
    }

    /**
     *解抵押-解抵押确认
     *
     * @param condition
     * @return
     */
    @ApiOperation("解抵押-解抵押确认")
    @PostMapping("/sure")
    public IResponse sure(@RequestBody MortgageDto mortgageDto) {
        return this.mortgageService.sure(mortgageDto);
    }

}
